<?php
declare (strict_types = 1);

namespace app\index\controller;

use app\BaseController;
use app\common\model\Room as RoomModel;
use app\common\model\Swiper as SwiperModel;
use app\common\model\News as NewsModel;


class Index extends BaseController
{
    //首页
    public function index()
    {
        //轮播图列表
        $swiperList = SwiperModel::select();
        //新闻列表
        $newsList = NewsModel::select()->toArray();
        //客房列表
        $roomList = RoomModel::select()->toArray();

        return view('/index', [
            'swiperList' => $swiperList,
            'newsList' => array_slice($newsList, 0, 5),
            'roomList' => array_slice($roomList, 0, 4),
        ]);
    }
}
